package com.pair.micro.common.response;

//import io.swagger.annotations.ApiModel;
//import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

//@ApiModel(value = "RtData对象", description = "嘉悦云响应数据")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class RtData implements Serializable {

  // @ApiModelProperty(value = "服务层调用结果 true成功 false失败", required = true, example = "true")
  private boolean success = true;

  // @ApiModelProperty(value = "总页数(分页时使用)", example = "10")
  private Long pNum;

  // @ApiModelProperty(value = "总记录数(分页时使用)", example = "100")
  private Long pTotal;

  // @ApiModelProperty(value = "分页时间戳(分页时使用)", example = "1562901516129")
  private Long pTs;

  // @ApiModelProperty(value = "返回多条数据", example = "List")
  private List dts;

  // @ApiModelProperty(value = "返回单条数据", example = "Object")
  private Object dtObj;

  // @ApiModelProperty(value = "返回单个信息的值", example = "String")
  private String dtStr;

  private Boolean dtBool;

  // @ApiModelProperty(value = "返回额外信息Map", example = "Map")
  private Map<String, Object> extMap;

  public static RtData Success() {
    return new RtData(true);
  }

  public static RtData Fail() {
    return new RtData(false);
  }

  public RtData(List dts) {
    this.dts = dts;
  }

  public RtData(Object dtObj) {
    this.dtObj = dtObj;
  }

  public RtData(Long pTotal, List dts) {
    this.pTotal = pTotal;
    this.dts = dts;
  }

  public RtData(Integer pTotal, List dts) {
    this.pTotal = pTotal.longValue();
    this.dts = dts;
  }

  public RtData(Long pTotal, Long pNum, Long pTs, List dts) {
    this.pTotal = pTotal;
    this.pNum = pNum;
    this.pTs = pTs;
    this.dts = dts;
  }

  public RtData(Integer pTotal, Integer pNum, Long pTs, List dts) {
    this.pTotal = pTotal.longValue();
    this.pNum = pNum.longValue();
    this.pTs = pTs;
    this.dts = dts;
  }

  public void setpNumInt(Integer pNum) {
    this.pNum = pNum.longValue();
  }

  public void setpTotalInt(Integer pTotal) {
    this.pTotal = pTotal.longValue();
  }


}
